import type {ICategory, IProduct} from './interface';

export type Duplicate<S extends string, T> = { [K in S]: T };

export type OrderState = 'CANCEL' | 'PAY' | 'NEW';
export type ProductLevel = 'JUNIOR' | 'MIDDLE' | 'SENIOR';
export type ProductEpisodeIds = Duplicate<'episodeId', number>;
export type ProductType = 'COURSE' | 'FOREVER_VIP' | 'YEAR_VIP' | string;
export type SendCodeType = 'login' | 'register' | 'change';
export type Data<T> = T extends undefined | null ? null : T;
export type SubCategoryList = ICategory & {
    pid: number;
    level: ProductLevel;
};

export interface IPageRequest {
    page: number;
    size: number;
}

export type IBizIdPageRequest = IPageRequest & { id: number };

export interface ICategoryStateRequest {
    page: number;
    size: number;
    categoryId?: number;
    categoryParentId?: number;
}

export interface IPage<T> {
    total_page: number;
    current_data: T[];
    total_record: number;
}

export interface IResponsePage<T> {
    msg: string;
    code: number;
    data: IPage<T>;
}

export interface IResponseBase<T> {
    msg: string;
    code: number;
    data: Data<T>;
}

export interface ICardResponse {
    id: number;
    name: string;
    icon: string;
    summay: string;
    row_num: number;
    weight: number;
    card_type: string;
    column_num: number;
    product_list: IProduct[];
}

export interface IBannerResponse {
    id: number;
    del: number;
    name: string;
    img_url: string;
    pc_link: string;
    h5_link: string;
    expired: string;
    location: string;
    gmt_create: string;
    gmt_modified: string;
}

export type ICategoryResponse = (ICategory & {
    subCategoryList: SubCategoryList;
})[];

export interface IPlayUrl {
    vodType: 'HWYUN';
    duration: number;
    episodeId: number;
    playResult: string;
}

